package com.entity;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the DEPT_ database table.
 * 
 */
@Entity
@Table(name="DEPT_")
@NamedQuery(name="Dept.findAll", query="SELECT d FROM Dept d")
public class Dept implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="DEPT__DEPTID_GENERATOR", sequenceName="SEQ",initialValue=1,allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DEPT__DEPTID_GENERATOR")
	@Column(name="DEPT_ID")
	private long deptId;

	@Column(name="DEPT_IFDELETE")
	private BigDecimal deptIfdelete;

	@Temporal(TemporalType.DATE)
	@Column(name="DEPT_INTODATE")
	private Date deptIntodate;

	@Column(name="DEPT_LASTID")
	private BigDecimal deptLastid;

	@Column(name="DEPT_NAME")
	private String deptName;

	//bi-directional many-to-one association to User
	@OneToMany(mappedBy="dept")
	@JSONField(serialize=false)
	private List<User> users;

	public Dept() {
	}

	public long getDeptId() {
		return this.deptId;
	}

	public void setDeptId(long deptId) {
		this.deptId = deptId;
	}

	public BigDecimal getDeptIfdelete() {
		return this.deptIfdelete;
	}

	public void setDeptIfdelete(BigDecimal deptIfdelete) {
		this.deptIfdelete = deptIfdelete;
	}

	public Date getDeptIntodate() {
		return this.deptIntodate;
	}

	public void setDeptIntodate(Date deptIntodate) {
		this.deptIntodate = deptIntodate;
	}

	public BigDecimal getDeptLastid() {
		return this.deptLastid;
	}

	public void setDeptLastid(BigDecimal deptLastid) {
		this.deptLastid = deptLastid;
	}

	public String getDeptName() {
		return this.deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public List<User> getUsers() {
		return this.users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public User addUser(User user) {
		getUsers().add(user);
		user.setDept(this);

		return user;
	}

	public User removeUser(User user) {
		getUsers().remove(user);
		user.setDept(null);

		return user;
	}

}